﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LimpaGaragem.BLL.User
{
    public class Info
    {
        /// <summary>
        /// Get user
        /// </summary>
        public LimpaGaragem.Model.User.Info GetUser(int IDUser)
        {
            try
            {
                return new LimpaGaragem.DAO.User.Info().GetUser(IDUser);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        /// <summary>
        /// Insert new user
        /// </summary>
        /// <returns>ID USER</returns>
        public int InsertUser(  string Login,
                                string Name,
                                string Email,
                                string Password,
                                DateTime DataBirthday,
                                decimal CPF,
                                string Adress,
                                int? AdressNumber,
                                string AdditionalAdress,
                                decimal? CEP,
                                int? IDCity,
                                string Phone1,
                                string Phone2,
                                bool ShowContactInfo)
        {
            try
            {
                return new LimpaGaragem.DAO.User.Info().InsertUser( Login,
                                                                    Name,
                                                                    Email,
                                                                    Password,
                                                                    DataBirthday,
                                                                    CPF,
                                                                    Adress,
                                                                    AdressNumber,
                                                                    AdditionalAdress,
                                                                    CEP,
                                                                    IDCity,
                                                                    Phone1,
                                                                    Phone2,
                                                                    ShowContactInfo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Send email to confirm register
        /// </summary>
        public void SendConfirmationEmail(string RecipientMail, int IDUser, string UserLogin, string UserPassword, string UserName)
        {
            try
            {
                new LimpaGaragem.DAO.User.Info().SendConfirmationEmail(RecipientMail, IDUser, UserLogin, UserPassword, UserName);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        /// <summary>
        /// Validate confirm register of user
        /// </summary>
        public bool ValidateConfirmRegister(string key)
        {
            try
            {
                return new LimpaGaragem.DAO.User.Info().ValidateConfirmRegister(key);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        /// <summary>
        /// Alter user
        /// </summary>
        public void AlterUser(int IDUser,
                                string Login,
                                string Name,
                                string Email,
                                string Password,
                                DateTime DataBirthday,
                                decimal CPF,
                                string Adress,
                                int? AdressNumber,
                                string AdditionalAdress,
                                decimal? CEP,
                                int? IDCity,
                                string Phone1,
                                string Phone2,
                                bool ShowContactInfo)
        {
            try
            {
                new LimpaGaragem.DAO.User.Info().AlterUser( IDUser,
                                                            Login,
                                                            Name,
                                                            Email,
                                                            Password,
                                                            DataBirthday,
                                                            CPF,
                                                            Adress,
                                                            AdressNumber,
                                                            AdditionalAdress,
                                                            CEP,
                                                            IDCity,
                                                            Phone1,
                                                            Phone2,
                                                            ShowContactInfo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        /// <summary>
        /// Delete user
        /// </summary>
        public void DeleteUser(int IDUser)
        {
            try
            {
                new LimpaGaragem.DAO.User.Info().DeleteUser(IDUser);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        /// <summary>
        /// Alter password of user
        /// </summary>
        public void AlterUserPassword(int IDUser, string Password)
        {
            try
            {
                new LimpaGaragem.DAO.User.Info().AlterUserPassword(IDUser, Password);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        /// <summary>
        /// Alter status of user
        /// </summary>
        public void AlterUserStatus(int IDUser, int IDStatus)
        {
            try
            {
                new LimpaGaragem.DAO.User.Info().AlterUserStatus(IDUser, IDStatus);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
